<template>
  <div>
    <!-- 选车型配置开始--------------------------------------------------------------------- -->
    <el-divider content-position="left">用户管理</el-divider>
    <div class="box">
      <div>
        <div class="box1">
          用户姓名: <input type="text" placeholder="请输入用户名称" />
        </div>
        <div>用户电话: <input type="text" placeholder="请输入用户电话" /></div>
      </div>
      <div>
        <div class="box1">
          邮箱:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" placeholder="请输入邮箱" />
        </div>
        <div class="box1">
          用户密码:<input type="text" placeholder="请输入用户密码" />
        </div>
      </div>
      <div>
        <div>
          <el-button type="primary" size="mini" style="border-radius: 25px"
            ><i class="el-icon-zoom-in"></i>查询</el-button
          >
          <el-button
            type="warning"
            plain
            size="mini"
            style="border-radius: 25px"
            ><i class="el-icon-refresh-right"></i>重置</el-button
          >
        </div>
      </div>
    </div>
    <!-- 选车型配置结束--------------------------------------------------------------------- -->
    <!-- 列表开始------------------------------------------------------------------------------ -->
    <div>
      <el-table :data="tableData" style="width: 100%"  max-height="500">
        <el-table-column label="日期" width="180">
          <template slot-scope="scope">
            <i class="el-icon-time"></i>
            <span style="margin-left: 10px">{{ scope.row.date }}</span>
          </template>
        </el-table-column>
        <el-table-column label="用户姓名" width="180">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top">
              <div slot="reference" class="name-wrapper">
                <el-tag size="medium">{{ scope.row.name }}</el-tag>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="用户手机号" width="180">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top">
              <div slot="reference" class="name-wrapper">
                <el-tag size="medium">{{ scope.row.phone }}</el-tag>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="用户密码" width="180">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top">
              <div slot="reference" class="name-wrapper">
                <el-tag size="medium">{{ scope.row.password }}</el-tag>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="用户邮箱" width="180">
          <template slot-scope="scope">
            <el-popover trigger="hover" placement="top">
              <div slot="reference" class="name-wrapper">
                <el-tag size="medium">{{ scope.row.email }}</el-tag>
              </div>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="danger"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <!-- 列表结束---------------------------------------------------------------------- -->
      <!-- 分页开始---------------------------------------------------------------------- -->
      <div class="block">
        <!-- <span class="demonstration">直接前往</span> -->
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="currentPage3"
          :page-size="100"
        
          layout="prev, pager, next, jumper"
          :total="1000"
          style="font-size: 30px"
        >
        </el-pagination>
      </div>
    </div>
    <div class="footer"><div>车辆管理系统</div></div>
  </div>
</template>

<script>
export default {
  data() {
    return {

      tableData: [],

      // 分页------------------------------
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
    };
  },
  methods: {
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    // 分页--------------------
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
  },
  mounted() {
    let url = "http://localhost:9000/users";
    this.axios.get(url).then((res) => {
      console.log(res);
      this.tableData = res.data;
    });
  },
};
</script>

<style lang="scss" scoped>
.box {
  display: flex;
  justify-content: space-around;
  height: 130px;
  input {
    border-radius: 10px;
    height: 24px;
    border: 1px solid #e9e9e9;
    margin-left: 20px;
  }
  .box1 {
    margin-bottom: 30px;
  }
}
// 底部样式-----------------------------------------
.footer {
  overflow: hidden;
  div {
    text-align: center;
    height: 40px;
    background-color: #efefef;
    line-height: 40px;
    width: 85vw;
    position: fixed;
    bottom: 0;
  }
}
.box + div {
  border: 1px solid #e5e5e5;
  margin: 10px;
  background-color: #ffffff;
  height: 65vh;
  position: relative;
  .block {
    position: absolute;
    bottom: 0;
    height: 40px;
  }
}
</style>